home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CThingMath.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  7.4 KB  |  284 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CThingMath = ┬º┬ºnewclass(CThingMath,CThingContainer);
  6.    }
  7. }
  8.  
  9. package Local.Game.Thing
  10. {
  11.    import Local.Game.World.*;
  12.    import Local.Math.*;
  13.    import flash.events.*;
  14.    import flash.geom.*;
  15.    
  16.    public class CThingMath extends CThingContainer
  17.    {
  18.       
  19.       public static const SQRT2:Number = 1.4142135623730951;
  20.       
  21.       public static const mGravityDelta:CPosition;
  22.       
  23.       public static const SQRT1_2:Number = 0.7071067811865476;
  24.       
  25.       {
  26.          if(true)
  27.          {
  28.             SQRT1_2 = Math.SQRT1_2;
  29.             if(true)
  30.             {
  31.                SQRT2 = Math.SQRT2;
  32.             }
  33.             mGravityDelta = new CPosition(0,1);
  34.          }
  35.       }
  36.       
  37.       public var mBraking:Number = 1;
  38.       
  39.       public var mOrientation:Number = 1;
  40.       
  41.       public var mDelta:CPosition;
  42.       
  43.       public var mDestination:CPosition;
  44.       
  45.       public var mAngle:CAngle;
  46.       
  47.       public var mAcceleration:Number = 1;
  48.       
  49.       public var mSpeedScale:Number;
  50.       
  51.       public var mRandom:CRandom;
  52.       
  53.       public var mPosition:CPosition;
  54.       
  55.       public var mMaxSpeed:Number;
  56.       
  57.       public var mSpeed:Number;
  58.       
  59.       public var mAngleDelta:CAngle;
  60.       
  61.       public function CThingMath()
  62.       {
  63.          if(true)
  64.          {
  65.             mOrientation = 1;
  66.             if(true)
  67.             {
  68.                mAcceleration = 1;
  69.                mBraking = 1;
  70.             }
  71.             super();
  72.          }
  73.       }
  74.       
  75.       public static function SideOfLine(param1:Point, param2:Point, param3:Point) : Number
  76.       {
  77.          ┬º┬ºpush(param2.x - param1.x);
  78.          if(true)
  79.          {
  80.             ┬º┬ºpush(param3.y - param1.y);
  81.             if(true)
  82.             {
  83.                ┬º┬ºgoto(addr53);
  84.             }
  85.             ┬º┬ºgoto(addr51);
  86.          }
  87.          addr53:
  88.          ┬º┬ºpush(┬º┬ºpop() * ┬º┬ºpop());
  89.          if(true)
  90.          {
  91.             addr51:
  92.             ┬º┬ºpush(┬º┬ºpop() - (param3.x - param1.x) * (param2.y - param1.y));
  93.          }
  94.          return -┬º┬ºpop();
  95.       }
  96.       
  97.       public static function IsLogicalAnd(param1:Number) : Boolean
  98.       {
  99.          var _loc2_:String = null;
  100.          if(true)
  101.          {
  102.             _loc2_ = param1.toString(2);
  103.          }
  104.          return _loc2_.indexOf("1") == _loc2_.lastIndexOf("1");
  105.       }
  106.       
  107.       public function GetOrientationMatrix() : Matrix
  108.       {
  109.          var _loc1_:Number = NaN;
  110.          var _loc2_:Number = NaN;
  111.          var _loc3_:Number = NaN;
  112.          if(true)
  113.          {
  114.             _loc1_ = mAngle.mAngleRAD;
  115.             if(true)
  116.             {
  117.                _loc2_ = Math.sin(_loc1_);
  118.             }
  119.             _loc3_ = Math.cos(_loc1_);
  120.          }
  121.          return new Matrix(_loc3_ * mOrientation,_loc2_ * mOrientation,-_loc2_,_loc3_,0,0);
  122.       }
  123.       
  124.       public function OrientatePoints(param1:Array, param2:Array, param3:CPosition) : void
  125.       {
  126.          var _loc4_:Number = NaN;
  127.          var _loc5_:Number = NaN;
  128.          var _loc6_:Number = NaN;
  129.          var _loc7_:Number = NaN;
  130.          var _loc8_:Number = NaN;
  131.          var _loc9_:int = 0;
  132.          var _loc10_:Point = null;
  133.          if(true)
  134.          {
  135.             _loc4_ = mAngle.mAngleRAD;
  136.             if(true)
  137.             {
  138.                _loc5_ = Math.sin(_loc4_);
  139.                if(true)
  140.                {
  141.                   _loc6_ = Math.cos(_loc4_);
  142.                   _loc7_ = _loc5_ * mOrientation;
  143.                }
  144.                _loc8_ = _loc6_ * mOrientation;
  145.             }
  146.             _loc9_ = 0;
  147.          }
  148.          for each(_loc10_ in param1)
  149.          {
  150.             if(true)
  151.             {
  152.                param2[_loc9_++].SetXY(_loc10_.x * _loc8_ - _loc10_.y * _loc5_ + param3.x,_loc10_.x * _loc7_ + _loc10_.y * _loc6_ + param3.y);
  153.             }
  154.          }
  155.       }
  156.       
  157.       public function Accelerate_Gradient(param1:CPosition, param2:CPosition) : void
  158.       {
  159.          var _loc3_:Number = NaN;
  160.          var _loc4_:Number = NaN;
  161.          _loc3_ = param1.length;
  162.          _loc4_ = Math.min(mAcceleration,(mMaxSpeed - _loc3_) / mMaxSpeed * mAcceleration);
  163.          param1.Add(CPosition.NORMALIZE(param2,_loc4_));
  164.       }
  165.       
  166.       public function Accelerate_Speed() : void
  167.       {
  168.          if((mSpeed = mSpeed + Math.min(mAcceleration,(mMaxSpeed - mSpeed) / mMaxSpeed * mAcceleration)) > mMaxSpeed)
  169.          {
  170.             mSpeed = mMaxSpeed;
  171.          }
  172.       }
  173.       
  174.       public function OrientatePoint(param1:Point, param2:Point = null) : Point
  175.       {
  176.          var _loc3_:Number = NaN;
  177.          var _loc4_:Number = NaN;
  178.          var _loc5_:Number = NaN;
  179.          var _loc6_:Number = NaN;
  180.          var _loc7_:Number = NaN;
  181.          if(true)
  182.          {
  183.             _loc3_ = mAngle.mAngleRAD;
  184.             if(true)
  185.             {
  186.                _loc4_ = Math.sin(_loc3_);
  187.                if(true)
  188.                {
  189.                   _loc5_ = Math.cos(_loc3_);
  190.                   if(true)
  191.                   {
  192.                      _loc6_ = param1.x;
  193.                      if(true)
  194.                      {
  195.                         _loc7_ = param1.y;
  196.                         param1.x = _loc6_ * (_loc5_ * mOrientation) - _loc7_ * _loc4_;
  197.                      }
  198.                      param1.y = _loc6_ * (_loc4_ * mOrientation) + _loc7_ * _loc5_;
  199.                   }
  200.                   if(!param2)
  201.                   {
  202.                   }
  203.                   ┬º┬ºgoto(addr103);
  204.                }
  205.                param1.x += param2.x;
  206.             }
  207.             param1.y += param2.y;
  208.          }
  209.          addr103:
  210.          return param1;
  211.       }
  212.       
  213.       public function get mGradient() : CPosition
  214.       {
  215.          var _loc1_:Number = NaN;
  216.          var _loc2_:Number = NaN;
  217.          var _loc3_:Number = NaN;
  218.          _loc1_ = mAngle.mAngleRAD;
  219.          _loc2_ = Math.sin(_loc1_);
  220.          _loc3_ = Math.cos(_loc1_);
  221.          ┬º┬ºpush(┬º┬ºfindproperty(CPosition));
  222.          ┬º┬ºpush(_loc3_);
  223.          ┬º┬ºpush(mOrientation);
  224.          if(true)
  225.          {
  226.             ┬º┬ºpush(┬º┬ºpop() * ┬º┬ºpop());
  227.             ┬º┬ºpush(_loc2_ * mOrientation);
  228.          }
  229.          return new ┬º┬ºpop().CPosition(┬º┬ºpop(),┬º┬ºpop());
  230.       }
  231.       
  232.       public function Sign(param1:*) : Number
  233.       {
  234.          if(param1 < 0)
  235.          {
  236.             ┬º┬ºgoto(addr32);
  237.          }
  238.          else
  239.          {
  240.             if(param1 > 0)
  241.             {
  242.                ┬º┬ºpush(1);
  243.             }
  244.             else
  245.             {
  246.                ┬º┬ºgoto(addr31);
  247.                ┬º┬ºpush(0);
  248.             }
  249.             addr32:
  250.             -1;
  251.             return true ? ┬º┬ºpop() : ┬º┬ºpop();
  252.          }
  253.          ┬º┬ºgoto(addr31);
  254.       }
  255.       
  256.       public function Deaccelerate_Speed(param1:Number = 0.33) : void
  257.       {
  258.          ┬º┬ºpush(┬º┬ºfindproperty(mSpeed));
  259.          ┬º┬ºpush(mSpeed);
  260.          ┬º┬ºpush(mSpeed);
  261.          if(true)
  262.          {
  263.             ┬º┬ºpush(┬º┬ºpop() - ┬º┬ºpop() * param1);
  264.             ┬º┬ºpush(┬º┬ºpop() - ┬º┬ºpop() * param1);
  265.          }
  266.          var _loc2_:* = ┬º┬ºpop();
  267.          ┬º┬ºpop().mSpeed = ┬º┬ºpop();
  268.          if(_loc2_ < 0.3)
  269.          {
  270.             mSpeed = 0;
  271.          }
  272.       }
  273.       
  274.       public function Break(param1:Number = 0) : void
  275.       {
  276.       }
  277.       
  278.       public function get mPositionRef() : CPosition
  279.       {
  280.          return mPosition;
  281.       }
  282.    }
  283. }
  284.